{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d99946c6",
   "metadata": {},
   "source": [
    "### e其数值约为（小数点后100位）\n",
    "### 2.71828 18284 59045 23536 02874 71352 66249 77572 47093 69995 95749 66967 62772 40766 30353 54759 45713 82178 52516 64274"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0c7346f1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.7182818284590455\n"
     ]
    }
   ],
   "source": [
    "# 求阶乘\n",
    "def factorial(number):\n",
    "    if number == 1.0:\n",
    "        return 1.0\n",
    "    return number*factorial(number-1.0)\n",
    "\n",
    "# 根据e^x 幂级数张开式，当x=1时,n为精度参数\n",
    "\n",
    "\n",
    "def sum_toE(n):\n",
    "    retv = 2.0\n",
    "    for x in range(2, n+1):\n",
    "        retv += 1/float(factorial(x))\n",
    "    return retv\n",
    "\n",
    "\n",
    "retv = sum_toE(600)\n",
    "print(retv)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
